package com.snacks.map;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;
import android.view.MotionEvent;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class MyPlaceRoom extends Overlay {
	private Bitmap bmp;
	public static GeoPoint geoPoint;

	public MyPlaceRoom(Bitmap bmp, GeoPoint geoPoint) {
		this.bmp = bmp;
		this.geoPoint = geoPoint;
	}

	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		Point point = new Point();
		mapView.getProjection().toPixels(geoPoint, point);
		canvas.drawBitmap(bmp, point.x, point.y - bmp.getHeight(), null);
		shadow = false;
		super.draw(canvas, mapView, shadow);
	}

	@Override
	public boolean onTap(GeoPoint p, MapView mapView) {
		geoPoint = p;
		
		return super.onTap(p, mapView);
	}
	@Override
	public boolean onTouchEvent(MotionEvent e, MapView mapView) {
		if(e.getAction()==MotionEvent.ACTION_DOWN){
			
			// xac dinh 1 bien de cho phep keo anh do
			
		}else if(e.getAction()==MotionEvent.ACTION_MOVE){
			
		}
		return super.onTouchEvent(e, mapView);
	}
}
